<?php

declare (strict_types=1);
namespace App\Model;

use Hyperf\Database\Model\Relations\HasOne;
use Hyperf\DbConnection\Model\Model;
/**
 * @property int $id 
 * @property int $user_id 
 * @property int $num 
 * @property string $remark 
 * @property int $create_time 
 */
class IntegralDetail extends Model
{
    const UPDATED_AT = null;

    const CREATED_AT = 'create_time';

    public $dateFormat = 'U';

    /**
     * The table associated with the model.
     *
     * @var string
     */
    protected $table = 'integral_detail';
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $guarded = [];
    /**
     * The attributes that should be cast to native types.
     *
     * @var array
     */
    protected $casts = ['id' => 'int', 'user_id' => 'integer', 'create_time' => 'integer'];


    /**
     * 商品详情关联模型
     *
     * @return hasOne
     */
    public function user(): HasOne
    {
        return $this->hasOne(User::class, 'id','lower_id');
    }

    /**
     * 商品详情关联模型
     *
     * @return hasOne
     */
    public function user_coupon(): HasOne
    {
        return $this->hasOne(UserCoupon::class, 'order_no','order_no');
    }

}